import Post

#This class holds count variables for each status 
class StatusTotals:
	#Constructor
	def __init__(self):
		self.openCount = 0
		self.offTopicCount = 0
		self.notConstructiveCount = 0
		self.notARealQuestionCount = 0
		self.tooLocalizedCount = 0
	
	#Gets total number of posts (regardless of status)
	def getTotal(self):
		return self.openCount + self.offTopicCount + self.notConstructiveCount + self.notARealQuestionCount + self.tooLocalizedCount
	
	#Gets the number of posts belonging to a particular status
	def getCountByStatus(self, postStatus):
		if(postStatus == Post.PostStatusEnum.OPEN):
			return self.openCount
		elif(postStatus == Post.PostStatusEnum.OFF_TOPIC):
			return self.offTopicCount
		elif(postStatus == Post.PostStatusEnum.NOT_CONSTRUCTIVE):
			return self.notConstructiveCount
		elif(postStatus == Post.PostStatusEnum.NOT_A_REAL_QUESTION):
			return self.notARealQuestionCount
		elif(postStatus == Post.PostStatusEnum.TOO_LOCALIZED):
			return self.tooLocalizedCount
		return 0
	
	#Gets the ratio of a given post status to total posts.
	def getPostStatusRatio(self, postStatus):
		return float(self.getCountByStatus(postStatus)) / float(self.getTotal())
	
	#Increments the count value corresponding to the post status
	def increment(self, postStatus):
		if(postStatus == Post.PostStatusEnum.OPEN):
			self.openCount = self.openCount + 1
		elif(postStatus == Post.PostStatusEnum.OFF_TOPIC):
			self.offTopicCount = self.offTopicCount + 1
		elif(postStatus == Post.PostStatusEnum.NOT_CONSTRUCTIVE):
			self.notConstructiveCount = self.notConstructiveCount + 1
		elif(postStatus == Post.PostStatusEnum.NOT_A_REAL_QUESTION):
			self.notARealQuestionCount = self.notARealQuestionCount + 1
		elif(postStatus == Post.PostStatusEnum.TOO_LOCALIZED):
			self.tooLocalizedCount = self.tooLocalizedCount + 1